package customGUI.selectors;

import java.util.ArrayList;

import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;

public abstract class AccountSelector extends JPanel {

protected JComponent selector;
	
	protected AccountSelector(String label, JComponent selector){
		this.selector = selector;
		
		refreshAssetChoices();
		
		add(new JLabel(label));
		add(selector);
		
		setSize(selector.getWidth(), selector.getHeight());
	}
	
	public void refreshAssetChoices(){
		ArrayList<String> assetList = retrieveAccountList();
		setChoices(assetList);
	}
	
	public JComponent getSelector(){
		return selector;
	}

	public abstract String getSelectedUsername();
	protected abstract ArrayList<String> retrieveAccountList();
	protected abstract void setChoices(ArrayList<String> assetList);
	
	
}
